﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SIM.Geo.DA
{
    public class Base : IDisposable
    {
        private static Base xbase = new Base();
        public static Base CreateInstance()
        {
            return xbase;
        }

        protected SIMEntities _context;

        public Base()
        {
            _context = new SIMEntities();
        }

        public SIMEntities Context
        {
            get
            {
                if (_context == null) _context = new SIMEntities();
                return this._context;
            }
        }


        #region IDisposable Members

        public void Dispose()
        {
            if (_context != null)
                _context.Dispose();

            _context.Dispose();
        }

        #endregion
    }
}
